package cums.logic.json;

import java.util.Set;
import net.sf.json.processors.JsonBeanProcessorMatcher;
import org.apache.log4j.Logger;

/**
 * @time Dec 10, 2009, 3:39:54 PM
 * @author fdcube
 */
public class HibernateJsonBeanProcessorMatcher extends JsonBeanProcessorMatcher {

    private static Logger log = Logger.getLogger(HibernateJsonBeanProcessorMatcher.class);

    @Override
    public Object getMatch(Class target, Set set) {

        if (target.getName().contains("$$EnhancerByCGLIB$$")) {
            log.warn("Found Lazy-References in Hibernate object " + target.getName());
            return org.hibernate.proxy.HibernateProxy.class;
        }
        return DEFAULT.getMatch(target, set);
    }
}  
